package day3

trait Logged {
  def log(msg:String){ println("Logged: log")}

}
trait AMyLogger extends Logged{
  override def log(msg:String): Unit ={
    println("test:"+msg)
  }
}
trait BMyLogger extends Logged{
  override def log(msg:String): Unit ={
    println("log:"+msg)
  }
}

trait CMyLogger extends Logged{
  override def log(msg:String): Unit ={
    println("CMyLogger : log:"+msg)
  }
}
class Person44(val name:String) extends AMyLogger{
  def sayHello(): Unit ={
    println("Hi ,i'm name")
    log("sayHello is invoked!")
  }
}

//class Person44(val name:String) extends  Logged{
//  def sayHello(): Unit ={
//    println("Hi ,i'm name")
//    log("sayHello is invoked!")
//  }
//}


object  Test55{
  def main(args: Array[String]) {
    val p1=new Person44("liudehua")
    p1.sayHello


    val p2=new Person44("zhangxueyou") with BMyLogger
    p2.sayHello

    println("*******************************************************")
    val p3=new Person44("zhangxueyou") with BMyLogger with CMyLogger
    p3.sayHello
  }
}

